package com.bwie.record.generator;

import java.util.Random;

public class RandomLicensePlateGenerator {
    private static final String[] PROVINCES = {"京", "津", "冀", "晋", "蒙", "辽", "吉", "黑", "沪", "苏", "浙", "皖", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "桂", "琼", "渝", "川", "黔", "滇", "藏", "陕", "甘", "青", "宁", "新"};
    private static final char[] LETTERS_AND_NUMBERS = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

    public static void main(String[] args) {
        System.out.println(generateRandomLicensePlate());
    }

    public static String generateRandomLicensePlate() {
        Random random = new Random();
        int provinceIndex = random.nextInt(PROVINCES.length);
        char letter1 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];
        char letter2 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];
        char number1 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];
        char number2 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];
        char number3 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];
        char number4 = LETTERS_AND_NUMBERS[random.nextInt(LETTERS_AND_NUMBERS.length)];

        return PROVINCES[provinceIndex] + "" + letter1 + letter2 + number1 + number2 + number3 + number4;
    }
}
